package com.wxq.workpad.finishproduct

import android.os.Bundle
import androidx.recyclerview.widget.GridLayoutManager

import com.wxq.workpad.adapter.BaseInfoTopAdapter
import com.wxq.workpad.base.BaseFragment
import com.wxq.workpad.databinding.FragmentBaseInfoBinding
import com.wxq.workpad.entity.ProductBaseInfoEntity

class BaseInfoFragment : BaseFragment<FragmentBaseInfoBinding>() {

    private var id: String? = null
     lateinit var baseinfoAdapter: BaseInfoTopAdapter
    private lateinit var baseInfoList:MutableList<ProductBaseInfoEntity>

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            id = it.getString("id")

        }
    }

    override fun init() {
       showToast("当前产品id")
        baseinfoAdapter= BaseInfoTopAdapter(mContext!!)
       binding.rvBaseInfo.apply {
           layoutManager= GridLayoutManager(mContext, 4)
           adapter=baseinfoAdapter
       }

        // 模拟获取数据
        baseInfoList=ArrayList()
        var base1= ProductBaseInfoEntity();
       var base2= ProductBaseInfoEntity();
       var base3= ProductBaseInfoEntity();
       var base4= ProductBaseInfoEntity();
       var base5= ProductBaseInfoEntity();
       var base6= ProductBaseInfoEntity();
        baseInfoList.add(base1)
        baseInfoList.add(base2)
        baseInfoList.add(base3)
        baseInfoList.add(base4)
        baseInfoList.add(base5)
        baseInfoList.add(base6)


        baseinfoAdapter.updateDate(baseInfoList)




        binding.rvList.apply {

        }


    }

    companion object {

        @JvmStatic
        fun newInstance(param1: String) =
            BaseInfoFragment().apply {
                arguments = Bundle().apply {
                    putString("id", param1)
                }
            }
    }
}